package top.yokey.shopnc.model;

import top.yokey.shopnc.base.BaseConstant;
import top.yokey.base.base.BaseHttpClient;
import top.yokey.base.base.BaseHttpListener;

@SuppressWarnings("ALL")
public class MemberOrderModel {

    private final String ACT = "member_order";
    private static volatile MemberOrderModel instance;

    public static MemberOrderModel get() {
        if (instance == null) {
            synchronized (MemberOrderModel.class) {
                if (instance == null) {
                    instance = new MemberOrderModel();
                }
            }
        }
        return instance;
    }

    public void orderInfo(String orderId, BaseHttpListener baseHttpListener) {

        BaseHttpClient.get().ready(ACT, "order_info")
                .add("order_id", orderId)
                .get(baseHttpListener);

    }

    public void orderCancel(String orderId, BaseHttpListener baseHttpListener) {

        BaseHttpClient.get().ready(ACT, "order_cancel")
                .add("order_id", orderId)
                .post(baseHttpListener);

    }

    public void orderDelete(String orderId, BaseHttpListener baseHttpListener) {

        BaseHttpClient.get().ready(ACT, "order_delete")
                .add("order_id", orderId)
                .post(baseHttpListener);

    }

    public void orderReceive(String orderId, BaseHttpListener baseHttpListener) {

        BaseHttpClient.get().ready(ACT, "order_receive")
                .add("order_id", orderId)
                .post(baseHttpListener);

    }

    public void orderList(String stateType, String orderKey, String page, BaseHttpListener baseHttpListener) {

        BaseHttpClient.get().ready(ACT, "order_list")
                .add("state_type", stateType)
                .add("order_key", orderKey)
                .add("page", BaseConstant.PAGE)
                .add("curpage", page)
                .post(baseHttpListener);

    }

}
